package function;


import java.awt.Frame;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class KeyMonitor extends KeyAdapter {
	int movex,movey,speed;
	Frame frame;
	public KeyMonitor(int x,int y,int speed,Frame frame){
		this.movex=x;
		this.movey=y;
		this.speed=speed;
		this.frame=frame;
	}
	public void keyPressed(KeyEvent e){
		int key=e.getKeyCode();
		switch(key){
		case KeyEvent.VK_RIGHT:
			movex+=speed;
			break;
		case KeyEvent.VK_LEFT:
			movex-=speed;
			break;
		case KeyEvent.VK_UP:
			movey-=speed;
			break;
		case KeyEvent.VK_DOWN:
			movey+=speed;
			break;
		}
	}
}
